package org.dong.samples.service;
import java.util.List;
import org.dong.samples.dao.ScoreHibernateDAO;
import org.dong.samples.model.Score;
import org.dong.samples.model.vo.ScoreVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
@Transactional
public class ScoreService {
	
	@Autowired
	private ScoreHibernateDAO scoreHibernateDAO;
	
	public void save(Score score){
		scoreHibernateDAO.save(score);
	}
	
	public List<ScoreVO> getScoreBySubject(String subName){
		return scoreHibernateDAO.getScoreBySubject(subName);
	}

	public List<ScoreVO> getScoreByuserId(String userId) {
		return scoreHibernateDAO.getScoreByuserId(userId);
	}

	public List<ScoreVO> getScoreByuserName(String userName) {
		return scoreHibernateDAO.getScoreByuserName(userName);
	}

	public List<ScoreVO> getScoreByTime(String timestamp, String timestamp2) throws Exception {
		return scoreHibernateDAO.scoreHibernateDAO(timestamp, timestamp2);
	}

	public void saveScore(Score score) {
		scoreHibernateDAO.saveScore(score);
	}

	public void saveChengji(int score) {
		scoreHibernateDAO.saveChengji(score);
	}
}
